package com.budwk.app.sqfw.controllers.admin;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.budwk.app.sqfw.services.SqfwSmsMsgService;
import com.budwk.starter.common.openapi.annotation.ApiOperation;
import com.budwk.starter.common.result.Result;
import com.budwk.starter.log.annotation.SLog;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;

import java.util.List;

@IocBean
@At("/platform/sqfw/smsMsg")
public class SqfwSmsMsgController {
    @Inject
    private SqfwSmsMsgService sqfwSmsMsgService;

    @At("/downExcelOfSqfwId")
    @Ok("json")
    @POST
    @ApiOperation(name = "短信表格下载")
    @SLog(tag = "短信表格下载", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> downExcelOfSqfwId(@Param("sqfwId") String sqfwId) {
        return Result.success(sqfwSmsMsgService.downExcel(sqfwId));
    }

    @At("/downExcelOfSummaryIds")
    @Ok("json")
    @POST
    @ApiOperation(name = "短信表格下载")
    @SLog(tag = "短信表格下载", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> downExcelOfSummaryIds(@Param("ids") List<String> ids) {
        return Result.success(sqfwSmsMsgService.downExcel(ids));
    }

    @At("/dataCheckOfSqfwId")
    @Ok("json")
    @POST
    @ApiOperation(name = "数据检测")
    @SLog(tag = "数据检测", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> dataCheckOfSqfwId(@Param("sqfwId") String sqfwId) {
        return Result.success(sqfwSmsMsgService.dataCheck(sqfwId));
    }

    @At("/dataCheckOfSummaryIds")
    @Ok("json")
    @POST
    @ApiOperation(name = "数据检测")
    @SLog(tag = "数据检测", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> dataCheckOfSummaryIds(@Param("ids") List<String> ids) {
        return Result.success(sqfwSmsMsgService.dataCheck(ids));
    }
}
